/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.com.sml.SEFM.BUS;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.persistence.RollbackException;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.SystemException;
import vn.com.sml.SEFM.DAO.UserDAO;
import vn.com.sml.SEFM.domain.User;
/**
 *
 * @author Tunp
 */
public class UserBUS {
     public static Integer saveUser(User user) throws SecurityException, RollbackException, HeuristicRollbackException, HeuristicMixedException, IllegalStateException, SystemException {
        return UserDAO.saveUser(user);
    }
    
    public static List<User> listUser() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException{
        return UserDAO.listUsers();
    }
    
    public static List<User> listUser(String search_col, String search_text) throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException{
        return UserDAO.listUsers(search_col,search_text);
    }
    
    public static Boolean UpdateUser(User user){
        return UserDAO.update(user);
    }
    
    public static Boolean DeleteUser(int id){
        return UserDAO.DeleteUser(id);
    }
    
    public static User getUserById(int id) {
        return UserDAO.getUserById(id);
    }
    
    public static User LogIn(String username, String password) {
        return UserDAO.LogIn(username, password);
    }
}
